﻿@model DemoApp1.Models.ManageModel
@{
    ViewBag.Title = "学生列表";
    var redirecturl = DemoApp1.Models.AppConfig.RedirectSiteUrl;
}
@section CSS{
    <style type="text/css">
        table {
            text-align: center;
        }

        tr {
            min-height: 30px;
        }

        .sso .com {
            width: 115px;
            text-align: center;
        }
    </style>
}
<div id="sso" class="form-horizontal" style="width:700px;margin:auto; margin-top:30px;">
    @*<div class="row">
        @using (Html.BeginForm("Search", "Home", FormMethod.Post, new { @class = "form-horizontal", id = "advanceSearchForm" }))
        {
            @Html.Partial("_filter", Model.SearchFilter)
            <div class="col-md-12" style="float:left;margin-top:10px; ">
                <input type="submit" style="background: #FAFAFA; width:70px;" class="btn btn-default" value="查询" />
            </div>
        }

    </div>*@
    <a href="@redirecturl">跳转到校务通</a>
    <div id="td" class="row">
        <table class="table table-checkable cw-table-respond" @*style="text-align:center; max-height:35px"*@>
            <thead>
                <tr>
                    <th class="com">
                        学生姓名
                    </th>
                    <th class="com">
                        学生学号
                    </th>
                    <th class="com">
                        年级
                    </th>
                    <th class="com">
                        班级
                    </th>
                    <th class="com">
                        创建时间
                    </th>
                </tr>
            </thead>
            <tbody>
                @foreach (var item in Model.IndexModel)
                {
                    <tr>
                        <td class="com">
                            @item.StudentName
                        </td>
                        <td class="com">
                            @item.StudentNo
                        </td>
                        <td class="com">
                            @item.EduYear
                        </td>
                        <td class="com">
                            @item.ClassName
                        </td>
                        <td class="com">
                            @item.CreateDate
                        </td>
                        <td class="com">
                            <a href="@Url.Action("Detail", "Home", new { id = item.ID })">查看</a>
                        </td>
                        @*<td>
                            <input type="button" class="btn btn-default" style="background:#FAFAFA;width:100px;" value="查看姓名" onclick="TestAjax(@item.ID)" />
                        </td>*@
                    </tr>
                }
            </tbody>
        </table>
    </div>
    <div id="studentname">
        <label id="lblname" style="color:red;font-size:24px;font-weight:bolder;">

        </label>
    </div>
</div>
@section scripts{
    <script type="text/javascript">
        function TestAjax(id) {
            $.ajax({
                type: 'Get',
                url: '@ViewBag.AjaxCallAuthUrl' + '?clientId=' + '@ViewBag.ClientId',
                data: {},
                xhrFields: {
                    withCredentials: true
                },
                success: function (data) {
                    if (data != null && data != undefined) {
                        debugger
                        var userName = data.Result;
                        $.ajax({
                            type: 'POST',
                            url: '@Url.Action("GetStudent")',
                            headers: { '@ViewBag.HeaderNameForAjaxAuth': data.Result },
                            data: {id:id},
                            success: function (data1) {
                                $("#lblname").text(data1.result.StudentName);
                                return;
                            }
                        });
                    }
                }
            });
        };
    </script>
}